<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GonzalesToolsTaxi.aspx.cs" Inherits="GonzalesToolsTaxi" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <link href="WebStyle.css" rel="stylesheet" type="text/css" />
</head>
<script language="javascript" type="text/javascript" src="js/common.js"></script>
<script language="javascript" type="text/javascript">
	
	var IsCashClaim = true;		
	
	function FillData() {
	
		var remarks = RequestQueryString("remarks");
		var amt = RequestQueryString("amt");
		var type = RequestQueryString("type");
		
		document.getElementById("TextBox_Type").focus();
		
		if (remarks != "") {
			var RemarksArray = remarks.split(",");
			var DestinationArray = RemarksArray[1].split("-");
				
			document.getElementById("TextBox_From").value = DestinationArray[0];
			document.getElementById("TextBox_To").value = DestinationArray[1];
			document.getElementById("TextBox_Purpose").value = RemarksArray[2];	
			document.getElementById("TextBox_Type").value = RemarksArray[0];							
			
		}
		
		if (amt != "") {
            document.getElementById("TextBox_TotalCost").value = amt;									
		}
		
		if (type != "" && type == "1") {
            IsCashClaim = false;									
		}		
	}
	
	var TabIndex = 0;
	
    function kH(e) {
        var pK = e ? e.which : window.event.keyCode;
        if (pK == 9) {
        
            if(TabIndex == 0){
                document.getElementById("TextBox_Type").focus();
            }else if (TabIndex == 1){
                        document.getElementById("TextBox_From").focus();
             }else if (TabIndex == 2){
                        document.getElementById("TextBox_To").focus();
              }else if (TabIndex == 3){
                        document.getElementById("TextBox_Purpose").focus();
              }else if (TabIndex == 4){
                        document.getElementById("TextBox_TotalCost").focus();
              }else if (TabIndex == 5){
                        document.getElementById("Button_Submit").focus();
              }else if (TabIndex == 6){
                        document.getElementById("Button_Cancel").focus();
               }
            
            if (TabIndex == 6) {
                TabIndex = 0;
            } else {
                TabIndex++;
            }
            
        }
        
        return pK != 9;        
    }
    document.onkeydown = kH;
    if (document.layers) document.captureEvents(Event.KEYDOWN);
	
	function TotalOnFocus() {
	    if (!IsCashClaim) {
	       document.getElementById("TextBox_TotalCost").blur(); 
	    }
	}
	
	function Validate() {
	
		var valid = true;
		var msg = "";

		if (document.getElementById("TextBox_Type").value == "" || document.getElementById("TextBox_From").value == "" || document.getElementById("TextBox_To").value == ""){ //  || document.getElementById("TextBox_Purpose").value == "") {
			valid = false;
			msg += MandatoryMessage;
		
		}

		if (!valid) {
			alert(msg);
		}
		else if (document.getElementById("TextBox_TotalCost").value < 0){
		    valid=false;
		    alert(NonNegativeMessage);
		}
		
		return valid;
	
	}
	
	function PassParameter()
	{
	    document.getElementById("hiddenClose").value = "true";
	    return true;
	}
</script>
<body>
<form id="Form1" method="post" runat="server">
  <table width="100%" border="0" cellpadding="2" cellspacing="1">
    <tr>
      <td height="40" class="PageTitle"><asp:Label ID="Label_Title" runat="server" Text='Transport Expense'></asp:Label></td>
    </tr>
    <tr>
      <td><asp:Label CssClass="NormalBodyText" ID="Label_Message" runat="server" Text='If you are given local transport allowance, you can only claim transport expenses for your oversea trips.' /></td>
    </tr>
    <tr>
      <td><table width="380" border="0" cellpadding="5" cellspacing="0" class="FormBorder">
          <tr>
              <td class="FormLineItemAlt">
                  <asp:Label CssClass="FormField" ID="Label1" runat="server" Text="Mode of transport :" /></td>
              <td class="FormLineItemAlt">
                  <input name="TextBox_Type" type="text" class="FormTextBox" id="TextBox_Type" value="TAXI/BUS/TRAIN/CAR" maxlength="15" /></td>
          </tr>
        
        <tr>
          <td class="FormLineItem"><asp:Label CssClass="FormField" ID="Label_Destination" runat="server" Text="Journey :" /></td>
          <td class="FormLineItem"><asp:Label CssClass="FormField" Width="45" ID="Label_From" runat="server" Text='From' />
                <input name="TextBox_From" type="text" class="FormTextBox" id="TextBox_From" size="11" maxlength="10"  /><br />
                <asp:Label CssClass="FormField" ID="Label_To" runat="server" Width="45" Text='To' />                
<input name="TextBox_To" type="text" class="FormTextBox" id="TextBox_To" size="11" maxlength="10"  /></td>
        </tr>
        <tr>
          <td class="FormLineItemAlt"><asp:Label CssClass="FormField" ID="Label_Purpose" runat="server" Text='Remarks (Optional):' /></td>
          <td class="FormLineItemAlt"><input name="TextBox_Purpose" type="text" class="FormTextBox" id="TextBox_Purpose" maxlength="15"  /></td>
        </tr>
        <tr>
          <td class="FormLineItem"><asp:Label CssClass="FormField" ID="Label_Cost" runat="server" Text='Claim amount:' /></td>
          <td class="FormLineItem">            <input name="TextBox_TotalCost" type="text" class="FormTextBox" id="TextBox_TotalCost" value="0" maxlength="15" onblur="DefaultValue(this, true);" onfocus="TotalOnFocus();" />          </td>
        </tr>
        <tr>
          <td class="FormLineItemAlt">&nbsp;&nbsp;</td>
          <td class="FormLineItemAlt">&nbsp;</td>
        </tr>
        
        <tr>
          <td colspan="2" class="FormLineItem"><asp:Button ID="Button_Submit" Text="Submit" runat="server" CssClass="FormButton" />
            &nbsp;<asp:Button ID="Button_Cancel" Text="Cancel" runat="server" CssClass="FormButton" /></td>
        </tr>
      </table></td>
    </tr>
  </table>
  <input name="hiddenClose" type="hidden" class="FormTextBox" id="hiddenClose" />  
</form>
<script language="javascript">
FillData();
</script>
</body>
</html>
